package cn.org.timespace.easyframe.util.bean;

import java.lang.reflect.Field;

public class DataType {
	static final public String STRING_TYPE = "java.lang.String";

	static final public String INTEGER_TYPE = "java.lang.Integer";

	static final public String SHORT_TYPE = "java.lang.Short";

	static final public String LONG_TYPE = "java.lang.Long";

	static final public String DATE_TYPE = "java.util.Date";

	static final public String DOUBLE_TYPE = "java.lang.Double";

	static final public String FLOAT_TYPE = "java.lang.Float";

	static public boolean isString(Field fld) {
		if (fld.toString().indexOf(DataType.STRING_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isInteger(Field fld) {
		if (fld.toString().indexOf(DataType.INTEGER_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isShort(Field fld) {
		if (fld.toString().indexOf(DataType.SHORT_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isLong(Field fld) {
		if (fld.toString().indexOf(DataType.LONG_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isDate(Field fld) {
		if (fld.toString().indexOf(DataType.DATE_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isDouble(Field fld) {
		if (fld.toString().indexOf(DataType.DOUBLE_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isFloat(Field fld) {
		if (fld.toString().indexOf(DataType.FLOAT_TYPE) > 0
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

	static public boolean isNumber(Field fld) {
		if ((fld.toString().indexOf(DataType.SHORT_TYPE) > 0
				|| fld.toString().indexOf(DataType.INTEGER_TYPE) > 0
				|| fld.toString().indexOf(DataType.LONG_TYPE) > 0
				|| fld.toString().indexOf(DataType.FLOAT_TYPE) > 0 || fld
				.toString().indexOf(DataType.DOUBLE_TYPE) > 0)
				&& fld.toString().indexOf(" static ") < 0) {
			return true;
		}
		return false;
	}

}
